If a prepare spell with one or more targets has no legal targets when it tries to resolve, it won't resolve and none of its effects will happen. Since the spell was cast, the associated permanent will still not be prepared.
Defacing Duskmage // Vandal's Edit
Preparation cards can only be cast with their base characteristics.
If a prepared creature stops being a creature, it will still be prepared, and the copy of its prepare spell will remain in exile. That permanent's controller will still be able to cast it. The same is true if a prepared creature becomes a copy of something else, even if it's then a permanent without a prepare spell.
Magic: The Gathering · ™ & © Wizards of the Coast · Illus. Daneen Wilkerson
Card data via Scryfall. Rarix is fan-made; not endorsed by the rights holders.
