Undying reads: 'When this creature dies, if it had no +1/+1 counters on it, return it to the battlefield under its owner's control with a +1/+1 counter on it.' The word dies has a precise rules meaning: a creature dies when it moves from the battlefield to the graveyard (CR 700.4). Exile is an entirely separate zone from the graveyard.
If a creature with undying is exiled instead of going to the graveyard — for example by a card like Swords to Plowshares, Path to Exile, or via a replacement effect such as the one created by Rest in Peace — the creature never visits the graveyard. Since the 'dies' condition is never met, undying's triggered ability never triggers (CR 603.2).
Replacement effects are especially important here. An effect like Rest in Peace says 'If a card would be put into a graveyard from anywhere, exile it instead.' This replaces the event of going to the graveyard entirely, so undying never sees the trigger condition fulfilled (CR 614.1).
Concrete example: You control a Strangleroot Geist (which has undying) with no +1/+1 counters. Your opponent casts Swords to Plowshares targeting it. Strangleroot Geist is exiled — it does not go to the graveyard, so undying does not trigger, and Strangleroot Geist stays in exile.
In short, only a trip to the graveyard counts as dying. Any time a creature leaves the battlefield by going to any other zone — exile, the hand, the library — undying will not trigger.
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.