I remember a conversation I had with my mom a while back ago.. she got upset the dog went in her room and ate the moldy yogurt she kept on her floor. She was upset because she was afraid the dog would get the runs and leave a mess on the carpet.
I remember thinking.. If you don't want the dog to get into your room, just close the door. Or, better yet, don't keep moldy yogurt, rotting fruit, and other expired items on the floor of your bedroom