What are the possible pitfalls of a university employee and a student being roommates? Is it best to avoid this situation?
Yes, it's basically allowed everywhere I know of, but there are plenty of situations where it might get weird. On the non-weird end of the spectrum, I was a researcher and manager at my university when my live-in fiancee decided to go to grad school there in a different department. We even got married the summer between the two years of her master's program. There were no problems and no rules that prevented this. We didn't even need to tell anyone about it.

Now, if she had worked for me or enrolled in a class that I taught, there would have been some people we would have needed to tell to make sure that there was no favoritism for her and that everything was fair for other students or employees. She probably would have had to have a different manager appointed for work if I would have otherwise been her boss, etc. Our living situation wasn't the determining factor, but rather our romantic involvement.

If the staff member isn't romantically involved with the student who is also their roommate, then there's generally no issue. However, if the nature of the relationship changes from roommates to partners, then depending on local rules and the proximity of the staff member's job to the student, someone probably has to be notified at the very least and a management plan created in some cases to deal with it. If the student and the staff member aren't in the same department, then there's usually no need for notification at my university.

E.g. if a psychology student wants to room with an admin in the Geology department, it's fine. If a student wants to rent a room from his English professor, then maybe some departments want to know that. If a Physics student wants to date/marry a Sociology prof they will never take a class from, it's very likely that the university needs to know, and they may try to forbid it. And if a student wants to become involved with their PhD supervisor, the university will definitely get to have a say.

As best I can tell, the rules tend to be about who is romantically involved with whom, not where students choose to find their accommodations.