They're both correct. I'd say that "at university" and "in hospital" are British. If you use "at university" and "in the university" in sentences, we can better advise if there's a difference in meaning.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.