After you vs Palkia go to Lake Verity and into the cave. Mespirit will be there and will flee when you see her. Get the Poketracker app from the president guy in Jublife city to track down Mespirit.
When you go to find her have a Pokemon first in your party that knows mean look.
If it's not first Mespirit will flee before you get the chance to switch out.
Make sure you have a master ball.