Usually what I will do is put my hand on the knob in such a way that if there is anyone in there, they will hear the knob being grasped. But I will wait a number of seconds before I try to turn it (in the thinking that if there's anyone in there they will probably hear that initial sound and make a noise). If there is nothing, I will turn the knob and open the door slightly (not far enough to see anything) and wait a few more seconds. If all is still well, I slowly open the door just to give them a few more seconds to say "HEY MAN! I'm pooping in here!"