A prison in a dream usually reflects a sense of restriction that feels self-imposed as much as external -- a job, a relationship, or a pattern of thinking you can't seem to step outside of. Guilt can also show up disguised as confinement, so it's worth asking what exactly you feel you're being punished for.
Give not judgment before thou knowest the intention of the querent; for many ask they know not what, nor can they express what they intend. - William Lilly (1602.-1681.)