The second data release from the European Pulsar Timing Array. II. Customised pulsar noise models for spatially correlated gravitational waves