Can Thraben Heretic be used on creatures with undying?
Yes.

Undying is a triggered ability, not a replacement effect. That means Undying creatures still "die" -- meaning that the card is placed into the graveyard from the battlefield. Then its Undying ability goes on the stack. You can activate Thraben Heretic in response to exile the creature card from the graveyard. The Undying ability do nothing when in resolves because the card it's supposed to fetch back to the battlefield is no longer in the graveyard.