Just some food for thought and not an actual attempt to fix your problem, but what stops PCs from doing the same thing to these foes?
I had a similar conundrum a few years back and in the end just left things alone. Mainly because PCs with a ranged weapon equipped would usually auto fire back at the unseen enemies anyhow.
A non-scripted solution which I have used at times is to just decrease an NPCs perception range in the toolset (even if this meant making tweaked copies of "normal" versions). Default perception ranges are set in the Appearance 2da, but you can increase/decrease the ranges in a window found at the bottom of the advanced page in a creatures properties.