I only recognise this from watching American TV/films. Yes, they literally put a sock on the door.
But if your roommate locked you out and her boyfriend in (but no sock signal), I suppose you could say to another friend "can I sleep on your couch? My roomie's put a sock on the door." Your friend would understand. ;)