1) if at work, go back to your desk via the post room/ water fountain, so you have an excuse for not being at your desk and no-one can guess where you really went.
2) at a boyfriend's house, make him go to the corner shop to get a newspaper. or if his toilet is separate from the bathroom, go when he's in the bath. or tell him you need to spend a whole afternoon in the bathroom coz you are dyeing your hair - hopefully he will get bored and go out - make sure to dye your hair as well as to poop! or wait until he is totally engrossed in a telly programme that he really wants to watch
3) at a friend's house, go in the middle of the night or tell them you have a stomach bug and that's why you have to spend a long time in the loo (or go often and try but fail to poop). also try blocking your ears and reading a magazine or counting the bathroom tiles, so that it takes your attention away from the fact that there are other humans nearby
4) put a bit of paper in the loo first so there won't be a noisy splash