I guess that would be less of a problem for an ocean-going vessel than it is for a truck
But seriously, the urea pellets are carried on board, and then mixed with distilled water. I guess it's not so hard to do that while surrounded by water, considering that some residual heat from the engine itself could also serve the water distillation.