Mesprit can be found at Lake Verity, which is the lake near your character's hometown of Twinleaf Town. Use Fly to reach this town easily, and then swing northward out of it. Go west along Route 201 to reach Verity Lakefront, and then swing northward to reach the lake itself. Use Surf on the lake to reach an isolated cave in the middle of the water, and subsequently enter the cavern. Here, you'll find Mesprit. When you confront it, however, he'll run off (though his information is added to the Pokedex, in case that's all you care about).
It's at this point that Professor Rowan will show up on-scene. He'll tell you that you can use the Poketch application Marking Map to find it (if you don't yet have it, he recommends visiting the Poketch Company in Jubilife City to get it). However, finding Mesprit is annoying. Once his location is shown on Marking Map, you'll need to get to that location manually. Attempting to cut any corners by using Fly, for instance, will nullify Marking Map's findings. So, if you really want to capture Mesprit, then you have to go to Jubilife city.Go up and down untill mesprit goes between Jubilife and Canalaive.Be in Jubilife when Mesprit is there.Go to canalaive city and use surf.Then use block or mean look and capture Mesprit.Good luck!