Could you explain better please? You're asking how to do stealth for the enemy AI?
I'm interested in how you imagine those kind of enemies in games and particularly in RPG.
For example, a game like Thief where Garrett is AI controlled and you are one of the guards. It wouldn't work with the same rules, as you would spot him in a second in that dark corner.
You would have to make those NPC with really quiet movement, and when they were sneaking make them stick to shadow and places with the lowest light and visibility, and maybe knock/kill a guard or two if they were in the way - but then they should be able to dispose of bodies (you could do that by placing a special maker in certain places so the AI could know)- and even steals their clothes to disguise themselves. As for spotting them in dark corners, that depends if they are wearing dark clothes and how dark your games shadows really are. There is a multiplayer mode in Chaos Theory called "Spies vs Mercs", where one team plays the deadly guards and hunts the non-lethal rouges, and trust me they are not easy to spot (unless they are running in lightened places).
If you are more curious about how this plays, than here you go:
As for RPG, should the detecting abilities be tied to your stats via, let's say, Perception (i.e. you ran a successful check and enemy became visible), or should it be up to player to be perceptive?
For this one it's like I said in my first post.
If it's an ARPG (like Underworld, Gothic, Morrowind, Deus Ex, Dark Messiah), then it a bit harder to do. Because after all it's an Action RPG, so the both the Player's Skill and the Character Skill should have an equivalent amount of impact in the Player's sucess.
The enemies detecting abilities shouldn't be a skill check but they should be different from each other in that regard.
Ex.: Humans have 120º FOV (with some weak peripheral vision), see 30 meter's ahead and hear 20 around them - but stuff like helmets could change; while dogs have 60º FOV and can only see 15 meters ahead, but have a incredible hearing and a additional smell sense; etc...
Essentially what the skill should do is make the character harder to detect yes but without sacrificing the player's skill factor. That's why I think the way I describe in my first post is the best - player with low skill is loud and sloppy so he need to be more careful, while a high level player is as silent and delicate (if not more) as Garret/Sam Fisher.
For any other type of RPG that relies more on the systems, formulas (the numbers) you can and should make the detections more reliant on the stats, but there still need to be some type of logic and player skill behind it.
Like enemies field of vision/hearing. Example:
(I know the edit is kind of shitty but bear with me here)
The character selected (the mage Warren) is an enemy. The 3 character with blue circles is our team. The green area represents Warren's field of view (what he can see), while the red area represents his hearing range.
Any character on his green area is immediately seen by him, and such he will be able to attack them - and like you can see other objects obstruct his view (in this case is the house).
However character on his red area may not be immediately heard by him. What determines if he hears you even when a character is in his area is if that character has made any kind of movement and that character's sneaking skill in relations to Warren's (like your example) perception stat (or simply the perception stat determines the distance he can see and hear). So the 2 characters with light blue circles may or may not be detected (depending on their skill) while the one in the dark blue circle doesn't have any worries.
Of course just because he heard them doesn't mean he knows for sure that they are there so he needs to check it. The enemies will only know for sure where your party members are if they see you.
You can them do alot of additional shit with this: the higher the elevation the FOV gets a bonus (but the hearing stays the same); during nigh time vision field is diminished while hearing gets a slight bonus (and rain/snow and other weathers can also modify this); you could even put that like the NPC's you can only know where other character's are if you see them.