In English there is a difference in meaning between "at school" and "at the school". To say "at school" implies that someone is attending the school as a student, rather than just there to pick up their child or something. Similar situation with "in hospital" (as a patient) and "in the hospital" (as a visitor), and "in prison" (as an inmate) and "in the prison" (as a visitor or officer).
I would make that distinction more with "in" than "at"; perhaps an American v. British issue? Also we would say "in the hospital" for a patient, and at the hospital for a visitor (same with prison).
In the US we would typically use "in prison" for a convict and "at the prison" for a visitor, unless we were emphasizing the fact that the visitor in question is inside the prison and not, say, hanging around outside the walls.
We also never say "in hospital" and it actually sounds ungrammatical to me, except I suppose in the context of a newspaper headline or a hyphenated adjective.
Right, it generally works the same way in the UK as far as what you say about "in/at the/in the prison" goes. We just extend the same principle to other institutions, such as schools and hospitals, whereas it seems that you don't.
We do it with school as well. He's in school. He's in jail. They're in congress. Hospital is the odd one out.