Health problems can cause litterbox problems. Cats don't always act sick, even when they are. Only a trip to the veterinarian for a thorough physical exam, which may include a urinalysis, can rule out a medical problem. If you cat is given a clean bill of health by your veterinarian, the next step is to determine whether your cat is spraying or urinating outside the box. Spraying is urine marking behavior, and is a cat's way of indicating ownership of her territory.
Marking is triggered by the presence of other cats.
Unfamiliar objects, smells, or people in the house can also cause the behavior. Spraying has nothing to do with litterbox habits. Male, female, spayed or neutered cats of any age may spray, although the behavior is more common in intact males. Try blocking off windows where your cat can see neighborhood cats. Discourage their presence with offensive odors.