Here, Hamlet is using a metaphor. Metaphors compare two things, yet differ from similes in that they don't use "like" or "as." He is comparing Denmark to a prison, meaning that he feels that the city is confining and bleak.
C. My English teacher gave me a million and one pages to read tonight!