To avoid this, try thinking like a hacker. They can hack anything they want into the game... So they're really just looking for level 100's of obscure stuff- or legit pokemon. How I avoided this was getting all valuable pokemon by myself... I only use the GTS for loose-end pokemon from games I don't have access to. Asking for a lvl 100 or an event pokemon = you're getting a hacked pokemon, chances are. If you put up your fresh Palkia... It's lvl 70, etc, hackers are going to assume it's legit, and hack whatever you want for it to get it. So you lost a pokemon you can only get once-per-playthrough for a hacked pokemon.
Another thing to keep in mind is that the eggs from hacked pokemon are legit.
However, the difference only really matters if you plan on doing something with them that requires you to not have hacked pokemon. There is no practical difference in a pokemon generated by your cartrige, or a AR device or something... Unless they nerf it or something trying to be cute.