Literally just went through this, had to tear out my carpet b/c NOTHING got the odor out and he kept doing it. Took him to the Vet and had a UTI, so we got meds, kept him isolated for a while and we are good to go now (knock on wood). The vet did say that sometimes cats will do it for different reasons too. Before we got the test results, she told us to change the area for the litter box, get a new litter box, keep the litter box super super clean. She also said that if there is a stray cat in the neighborhood that your cat hears, it might be a territory thing.
Even though our cat had a UTI, we still got a new box, changed the location of the litter, tore out the carpet and we make sure the cat box is cleaned daily if not twice a day.
Hope this helps :)