You do not have to be unseen, although being seen will cost you a Ghost XP bonus. You just need anyone who sees you not to have an opportunity to set off an alarm. Some areas have no alarm whatsoever, so you cannot fail there. Some alarms are scripted and guaranteed to happen as the story progresses. These will not count against you either.