Copied from PlayStationTrophies.org:
Getting the Z-Saber requires a very specific process. Here is what you have to do:
1. Keep Zero alive. Don’t use him.
2. You have to beat Vile MK-2 prior to beating all 8 Mavericks by finding one of his hidden teleporters.
3. Beat Vile with the Spinning Blade weapon.
4. When you get to Dr. Doppler stage 2, stop before entering the first sub boss room where you face the Mosquitus. At this point, swap out Zero.
5. Zero should go into the battle ready to use a fully charged Z-Saber strike, i.e., he should be flashing green. Get rid of any buster charges, as they are pointless.
6. Zero should defeat it, preferably with the Z-Saber.
7. The Mosquitus will kamikaze Zero, weakening him and taking him out of the game. At which point he will give X the Z-Saber.
To get straight to the beginning of all this, use this password to have all Mavericks except for Volt Catfish dead with all power ups and Zero still active. You can visit a Vile teleporter right away in this stage by riding the first elevator down the spike laden pit.
6414
4157
6872
1356
Here's a video: