Two different questions here. Firstly, here's the Rosencrantz bit you refer to (from Act 2, Scene 2):
Why, then your ambition makes it one. 'tis too narrow for your mind.
O God, I could be bounded in a nutshell and count myself a king of infinite space, were it not that I have bad dreams.
Rosencrantz argues that Hamlet is too ambitious for Denmark, and longs for new pastures - and broader possibilities. Hamlet replies that it's nothing to do with the physical space of Denmark, or his ambitions - as if you shut him up in a nutshell, he could believe he was a "king of infinite space". In other words, he could think himself into liking even a nutshell - but Denmark is negative and provokes negative thoughts: "bad dreams". It's not that there isn't enough space, but that Denmark is an awful place.
Secondly, Hamlet 's thoughts on the purpose of the army are made very clear:
....while to my shame I see
The imminent death of twenty thousand men
That for a fantasy and trick of fame
Go to their graves like beds, fight for a plot
Whereon the numbers cannot try the cause,
Which is not tomb enough and continent
To hide the slain?
Hamlet thinks that these 20,000 men are all going to their deaths - and, as he's just been told by the Officer, they are fighting over a tiny bit of land that doesn't even bear fighting over. Their purpose is pointless - purposeless.
I could be bounded in a nutshell and count myself a king of infinite space, were it not that I have bad dreams.
(In other words.... You could physically lock me in a tiny tiny space and I would still feel like The King of The Universe because the space inside my head is infinite and I can move freely in my mind. But, unfortunately for me (hamlet), that infinite space inside my head is rather dark and unhappy lately, so being shut in it is not so good anymore.)
Rosy says Denmark is too small for Hamlet's ambition and Hamlet says he is more interested in mental things (philosophical things) than physical things. We can also infer that he used to be 'The King of Infinite Space', in other words his mind used to be a wonderful place to think and play before all his current troubles made him depressed and mentally unstable.