It's not that. It is considered a risk if the animal gets out more than that. If a rat, or hamster got out and got into another flat it could chew up furniture, carpet or curtains before it was found. If it died there the tenant could be left looking for a VERY nasty smell, not even knowing why.
It's just too close quarters. Additionally caged animals can smell, and in the close quarters neighbours can suffer.
I can't have pets because the family member we live with won't have them

I'd love fish for my daughter.