Baking soda is a safe, natural and very effective carpet deodorizer. How you apply it will depend on how large of an area you want to deodorize. If you need to remove pet odor from an entire room, buy a large box of baking soda and sprinkle it over the entire carpet. Work it in with a clean broom and sprinkle another layer. If you find you need a lot of baking soda, try buying it in the laundry aisle instead of next to the flour. You can also get large boxes of baking soda very inexpensively at feed stores, but you may need to ask for it. Allow it to sit on your carpet for 24 hours, then thoroughly vacuum your carpet. For a smaller area or a really strong odor, make a paste of baking soda and water, brush it into the carpet, and allow it to dry completely. Vacuum it up the next day.
You can use white vinegar on your carpet to remove strong pet odors. It's a good idea to test a small area to make sure the vinegar won't affect the color of your carpet, but it is very unlikely to cause problems and won't bother most carpets. Put the vinegar in a spray bottle and completely dampen the carpet. Allow the vinegar to sit for several hours and use a carpet steamer to remove it, along with all the odor. If you prefer you can leave it to dry in the carpet. Either way you will have a vinegar odor that lingers for a day or two, but as the vinegar smell dissipates, so does the pet odor.
Sprinkle the carpet with corn starch, then spray it with enough water to dampen it. Allow it to sit until it is dry, then vacuum it up. If the odor was very strong, you may want to repeat this, but usually once is enough. Be sure to use a clean vacuum bag to keep from transferring any odor back into the air as the corn starch is removed from the carpet. If you have an area where the odor is very strong, sprinkle the corn starch thickly over the area, brush it in, then dampen it. Let it sit overnight before vacuuming.