There is a little bit of truth in this. When burglars case a house, they might choose to leave a house with a barking dog alone all else equal. That said it won't stop a determined burglar or home invader, but it can dissuade a casual intruder.