There are really no glitches in the game where this can happen. However, if you use a master (which every one knows so i won't belittle myself) it will work.
If you use an external game hacking source like a GameShark (for gameboy sp or color) or an action replay (for a ds), there are codes you can put into the system in the action replay or gameshark so that you can do special things.
But you'd have to Google "Action Replay for Pokemon Emerald" or something like that.
This cheats in the system may include:
-catch with no fail
-walk through walls
-unlimited health
-unlimited master balls
-unlimited rare candy
etc. etc. etc.
there ya go, have fun cheating in the game fellow Pokemon player :)
Chat with our AI personalities
Of course, a Master Ball catches any Pokemon without fail, Legendary or not.
You should use a "Timeball". Go in the battle, and fight 20 minutes, then you should catch without failing.
In battle, teleport will allow you to escape from wild encounters without fail (with the exeption of pokemon with the abilities shadow tag, or arena trap). Outside of battle, it will take you to the last pokemon center you have visited. This is the same for all other pokemon games.
Go up to the Dotted Hole door on Six Island and have a Pokemon use Cut the door will open without fail but save after entering
In Battle: You can escape from wild Pokemon easily and without fail. It does not work in trainer battles or else it'll say it failed. In Field(Outside of battle): When you go through your Party and select the Pokemon with the move Teleport, you'll instantly go back to the latest Pokemon Center you have visited, regardless of what city/town it is in.