I have a Maxi-Cosi Opal car seat, the foam/polystyrene part of the headrest is broken. Can this be replaced?

Yes, the foam part of the headrest can be easily replaced with a new one.