Although the gemorah in Pesachim (112a) strongly suggests knocking before entering a room is a good custom to have, is there an obligation to do so? If there is, is there a heter for those who don’t seem to be stringent on knocking before entering?
The Rashbam on that gemorah says that the reason for this is because the person may be doing something private there. Therefore it is possible that when there is no reason to be wary hat something private is taking place in the room that people are lenient. This would apply to when someone is entering his own domain, however when going into someone else’s house etc. there is another reason, because of derech eretz, and then this would not apply.