I'am not sure i follow you here this just makes no sense to me. It makes sense if that defender can't see the attacker but if it can see the attacker it can also defend.
I have to agree with Alberts2 on this - It is illogical.
Just because the attacker can not see me - does not stop me from defending/attacking.
In fact it probably an old hunting technique for capturing larger animals.
I hide in the bush's downwind. Tie a small animal to a bush/tree etc. Wait for a larger animal to come along and attack it. As it approaches my trapped bait (it can not see me) but I jump out of the undergrowth and attack it. Same could be said for human bait.
This is how it's always been. The invisible 'defender' has always not been able to stage a tile defense as the game will assume 2 things:
1) the defender will want to remain invisible and unseen.
Wrong assumption sometimes.
You probably need more action buttons.
1. Hide and stay hidden - regardless of what happens to other units. (i.e. a spy)
2. Hide but be ready to ambush and defend other units.. (ie, hunter or special forces trap etc)
2) it would be unfair to both the defender (potentially) and the attacker since neither side has made any determination as to the odds of the battle whether battle would be wise.
But that is the point - the attacker does not know the hidden defender is there. If it is considered unfair to the attacker - what is the point of having this feature in the mod.
As for the hidden unit defending - do an odds calculation on success to decide if it should defend or stay hidden (greater than 75% - defend, if less stay hidden).
Otherwise you could go hunting for the unseen by simply fanning out and poking your attack units around until they hit the unseen target.)
Is'nt that what you do anyway when exploring/hunting?