1. The "prison" of Denmark: Hamlet uses the word "prison" itself to describe the kingdom of Denmark. He sees it as a place that restricts his freedom and limits his choices. This is evident in lines like:
* "This goodly frame, the earth, seems to me a sterile promontory; this most excellent canopy, the air, look you, this brave o'erhanging firmament, this majestical roof fretted with golden fire—why, it appears no other thing to me than a foul and pestilent congregation of vapours. What a piece of work is a man! How noble in reason, how infinite in faculty! In form and moving how express and admirable! In action how like an angel, in apprehension how like a god! The beauty of the world, the paragon of animals—and yet, to me, what is this quintessence of dust? Man delights not me—no, nor woman neither, though by your smiling you seem to say so." (Act 2, Scene 2)
* “O, that this too too solid flesh would melt,
Thaw, and resolve itself into a dew!
Or that the Everlasting had not fix'd
His canon 'gainst self-slaughter!” (Act 1, Scene 2)
2. "The slings and arrows of outrageous fortune": This is the famous line that describes the troubles Hamlet faces. He feels trapped by fate and the circumstances he's born into. He is burdened by the responsibility of avenging his father's murder, but also feels powerless to act. This is another way he expresses feeling "imprisoned" by his situation.
3. The "cage": While not directly referencing a prison, Hamlet also uses the metaphor of a "cage" to describe his feeling of being trapped:
* "O, God! O, God!
How weary, stale, flat, and unprofitable
Seem to me all the uses of this world!
Fie on't! O fie! 'tis an unweeded garden
That grows to seed; things rank and gross in nature
* Possess it merely. That it should come to this!
But two months dead! nay, not so much, not two:
So excellent a king; that was to this
Hyperion to a satyr; so loving to my mother
That he might not beteem the winds of heaven
Visit her face too roughly. Heaven and earth!
Must I remember? why, she would hang on him
As if increase of appetite had grown
By what it fed on: and yet, within a month—
Let me not think on't—Frailty, thy name is woman!—
A little month, or ere those shoes were old
With which she followed my poor father's body,
Like Niobe, all tears;—why she, even she—
O, God! a beast, that wants discourse of reason,
Would have mourn'd longer—married with my uncle,
My father's brother, but no more like my father
Than I to Hercules: within a month:
Ere yet the salt of most unrighteous tears
Had left the flushing in her galled eyes,
She married. O, most wicked speed, to post
With such dexterity to incestuous sheets!
It is not, nor it cannot come to good:
But break my heart, for I must hold my tongue.” (Act 1, Scene 2)
4. The "prison" of his own mind: Throughout the play, Hamlet reveals that he feels imprisoned by his own thoughts and the burden of his responsibility. He struggles to act, paralyzed by doubts and introspection.
While he doesn't explicitly state "a prison is a prison," his repeated use of metaphors for confinement, coupled with his expressions of frustration and powerlessness, clearly reveal Hamlet's sense of being trapped and restricted.