Dogs have a keen sense of smell, and given the eminent odor of roaches, it's difficult for them to ignore them. Since roaches are quiet animals, it may be difficult for you to spot them, but your dog has acute hearing, so it can sense the roach as it moves or grumbles over food.