This can be done if the source of undeath counts as a curse
If the thing that caused the undead to arise in the first place counts as a curse, which includes but is not limited to any spell with the [curse] descriptor, and the source is not a spell of higher than 5th level, the spell Break Enchantment can undo it, being able to undo even instantaneous effects provided they are enchantments, transmutations, or curses. Enchantments and transmutations are defined things in the rules, but curses aren't.
You can also do this if the specific kind of undeath involved involves paralysis-- via Primal Scream and scrolls and Command Undead or diplomacy skill checks-- but that is both more complicated and less useful, generally speaking.
This can also be done lots of complicated ways
Beyond that, there's time travel via the Scepter of Ages, perhaps acquired via Black Market Connections. There's also Polymorph any Object which would allow you to turn a e.g. a zombie into a corpse permanently. There's also stealing the soul out of an undead target, via Trap the Soul or any more specialized lower level method. One may also be able to use Freedom or Freedom of Movement to render a soul free to return for the purposes of Clone et al. Resurrection and True Resurrection also work when cast on an undead creature: while the spells themselves say nothing beyond being able to raise undead creatures that have been destroyed, the description of the Undead type specifies that 'Resurrection and true resurrection can affect undead creatures. These spells turn undead creatures back into the living creatures they were before becoming undead.' Undead creatures that are turned back into living creatures won't be dead, though, so they'll still need to be corpsified via some other method to achieve de-animation. The Promethean corruption also incrementally transmits a creature's soul to the afterlife, eventually resulting in a mindless destructive automaton or free-willed evil construct, but one that doesn't have the original creature's soul. Killing this new creature is sufficient to deanimate the corpse, but the original creature will be basically impossible to raise from the dead at that point due to the other effects of the affliction.
There are probably other ways. What you are asking for are weird edge cases where something ceases to be alive (or unalive) without technically dying or being destroyed, and there's lots of unrelated weird edge cases in Pathfinder.