Inc. The most common reason a cat stops using its litterbox is because the box is dirty - from the cat's viewpoint, not yours.
Cats often react to any type of stress by suddenly urinating or defecating outside the litterbox.
Urinary tract problems also cause cats to urinate in places other than the litterbox. Any sudden change in elimination habits should be discussed with your veterinarian. Until your cat is reliably trained, she should not have free run of your home. If your cat continually makes mistakes, the behavior can simply become a habit. Punishing a cat after the fact teaches her to be afraid of you.