I’m not sure about CERN, but we detect cosmic rays quite regularly in our nitrogen cooled spectrometer. It’s fairly easy to remove them from the data for us. It might be harder in CERN tho, I’m sure James knows more about it.
Background radiation tends to be fairly constant and so you can normally take a background reading (take a measurement with no experiment happening) and then subtract this from your results (that’s what we do with our radiation diagnostics anyway).
The LHC isn’t that far underground because of cosmic rays – other particle accelerators are on or near the surface. Cosmic rays are an issue though. They are used to calibrate the detector when there isn’t any beam, but you also have to make sure when you detect a particle that it didn’t come from a cosmic ray. There are a few ways of doing this: the cosmic ray generally won’t arrive at the same time as a beam collision; the cosmic ray won’t point back to the collision point; generally the cosmic ray will be a different shape (and more isolated) in the detector.