I came across this thread two years ago doing random google searches for things like "pungent smell," "urine smell", "dead animal smell", "animal infestation" with combinations like "top floor," "attic," and other terms. I bookmarked the page and I'm now back having solved our problem.
We have a townhouse with the fourth floor being my kids' room and play area. Periodically, this pungent smell that would describe as somewhere between a mix of urine, cat litter, and pine needles would waft into the edge of the room. Sometimes it could happen several days in a row but then it would be gone for weeks or even months at a time. Usually the smell would only last for maybe an hour max, and opening a window would get rid of it in a few minutes. The weirdest part is that the smell was localized around the windows (but there are also outlets and a vent right under the windows). But when I opened a window, I would not smell anything outside. I sniffed the carpet, the vent, the kids' beds, the KIDS, the electrical outlet and appliances. I did this on and off for TWO YEARS. I had a pest control guy come out and go on the roof and look for any evidence of animals. I went into the attic. NOTHING. NOTHING. Going insane.
The smell came back last night with a vengeance and I sniffed all over the place. I eventually traced it to the base of the left window frame. But I couldn't see anything. I thought, maybe a squirrel urinated on the window earlier. This morning when it was light, I went back up and smelled the smell AGAIN. I sniffed around and traced it this time to the TOP of the MIDDLE window!! Again, when I open the window I couldn't smell anything! But then I noticed a STINK BUG on one side of the window screen. When I opened the window it must have scared him because I could see some wetness around the screen from where he sprayed toward me. It must have been angled to hit the top of the window frame because immediately I could smell that pungent smell. But I could only smell it directly at the top of the window frame. Opening the window and smelling right where the stink bug had been resting did not yield any smell.
So, it appears that stink bugs can spray into a VERY localized area that will permeate through CLOSED WINDOWS for up to an hour (I can still smell it between the closed window frame right now) and yet somehow will not be evidence when you open the window. I guess this is because the chemical they spray is not airborne. Stink bugs are very hard to see because they can be on the outside of your window frame, trim, or siding, but can spray several inches.
Anyway, I hope this can help some of you dealing with these phantom odors. I can't do anything to kill the bugs, especially since they are outside, but at least now I know the smell is not hazardous to my family. Good luck all!