Yes, that works fine for a space station, but not so much for a rocket that needs to accelerate and decelerate it on a trip to Mars (and back).
Especially for such rocket because you may need also additional fueling.
Starship already requires in-orbit fueling to fully refill its tanks for the outbound journey to Mars when loaded to its 100T payload limit. It cannot carry additional fuel to accelerate and decelerate another 100T+ of water shielding. SpaceX currently plans that Starship will return to Earth from the Martian surface without in-orbit refueling. I don't know the payload capacity for that trip offhand, but again water shielding would exceed the 100T mark and it would be an incredible amount of added complexity to do in-orbit refueling there with the limited fuel generation infrastructure.