In addition to Maker's post : If you want an hidden unit to not gain experience, just disable her experience gain. You can also use a Custom XP System that would do differences between hidden units and not hidden ones, so that it gives xp only to visible one.