That "classic" urine odor is really caused by the waste products of bacteria, so get to the problem quickly, before they have a chance to start multiplying.
Cleaning Fresh Urine Spills
On a fresh spill, blot up the moisture as soon as you can with towels, paper towels, or whatever you have that's dry, absorbent and colorfast. Don't scrub the moisture down into the carpet because it will naturally wick up to the top of thefibers and you don't want to work it down in.
Then, sprinkle Arm & Hammer® baking powder or baking soda (either one) over the damp area, covering it completely to a depth of about a quarter-inch. Don't rub it in. Use more than you think you really need, so you can't see any carpet through the powder.
Because the liquid naturally wicks upwards it will be drawn up from the fibers, out of the carpet, and into the powder. Let it sit one to two days until the powder is completely dry, then vacuum.
This should work if the spill is fresh and if it hasn't soaked into the carpet padding or the floor beneath.
Cleaning Older Urine Stains
For an older contamination that has an odor, you really only have two choices: professional cleaning or kill the bacteria growing in the carpet. If your carpet is made of wool or nylon, then you will probably need professional cleaners because products containing bleach will take the color out of nylon, and bleach will dissolve wool.
If you have carpet made of Olefin® or polyester, you can mix a solution of 1 part bleach to 10 parts water and soak the affected area with a trigger sprayer. After this mixture has had a chance to work for a couple of hours, then apply the blot, Arm & Hammer®, let it dry, and vacuum as above.
Nylon and Wool Carpets
Reminder: don't use bleach if your carpet is made of nylon or wool. If you aren't sure, don't do it. If you think you're sure, test this on an out-of-the way spot first, just to be certain.
If you have nylon or wool carpet and the spill is old and smelly, you can try thoroughly re-wetting the spill with water and then using the blot, Arm & Hammer®, vacuum method, but your chances of success are greatly reduced because this won't kill the bacteria actively growing in the carpet. You'll probably have to call in a professional.
The best cure is prevention, of course. If you have carpet in the bathroom, take it up if you can. If mishaps are occurring in other rooms—by the bedside, for instance—get some inexpensive rubber-backed bath rugs. Tape them down so they aren't a trip hazard. When an accident happens you can pull them up right away and throw them in the wash.