Enzymatic cleaners are great, but some people would spend HUNDREDS with their dog's accidents. So, what may be better for you is to use water, white vinegar, baking soda, peroxide and dish soap.
First clean the mess up as best you can with a towel or whatever.
Next, pour a 50/50 mixture of water and white vinegar on the area. Remember to soak the area liberally as it needs to not only reach the carpet fibers but the pad beneath the carpet. Then scrub it with a scrubbing brush or a toothbrush. Wait a couple hours to let the vinegar work, then blot up vinegar.
Then, sprinkle a good amount of baking soda over the area. Mix a 1/2 cup peroxide with 1 TSP (teaspoon) and slowly pour it over the baking soda.
Finally, once the baking soda is dry vacuum it all up. You may need to use the scrubbing brush to loosen the baking soda.
This will not only remove the smell for you, but for the dog as well, so he doesn't return to the area.
Note: If the area is very heavily soiled you may need to do this treatment a few times.
As everyone said, get a an alarm for you house, and get a crate for the dog.
Guard dogs take LOTS of work and immense practice, time, and patience.