There is no official invincibility cheat for Spider-Man 3 on PS2. The game has no cheat menu or code entry system for god mode.
Those versions have a debug menu (accessible via modded save/Action Replay) with god mode, but PS2 version does not.
Play smart: dodge, upgrade, control crowds. The game is beatable on Hero difficulty with patience.