Take your cat to the vet to diagnose, rule out, or address a medical problem such as pain and/or illness. Be sure to get your cat a urine and blood test!
- AVOID HUMANIZING YOUR CAT
Your cat isn't doing this to bully you, or because she's angry, or is a naughty or mischievous cat. Try to look at your cat as an animal, with needs and instincts and preferences and certain expectations of her environment.
By that we mean physical and/or invasive punishments such as startling, yelling, pushing, slapping, pushing her nose into urine on the floor, locking her away, throwing keys, etc (I've seen it all, multiple times). This will only make the unwanted behaviour worse. Either you do this by giving attention to the unwanted behaviour, or you may just make her emotions of fear, anxiety, and frustration worse.
- DO NOT PUNISH BUT TEACH & TRAIN
It is impossible to just 'unlearn' a behavior, because there is always a good reason behind it. Find that need (we'll help with that) and make sure that your cat can express that need in another appropriate location, time and way that is also satisfactory for her.