Context : Aims : More than half of all active galactic nuclei show strong photoionised outflows . We use a massive multiwavelength monitoring campaign on the bright Seyfert 1 galaxy Mrk 509 to constrain the location of the outflow components dominating the soft X-ray band . Methods : Mrk 509 was monitored by XMM-Newton and other satellites in 2009 . We have studied the response of the photoionised gas to the changes in the ionising flux produced by the central regions . We used the five discrete ionisation components A–E that we detected in the time-averaged spectrum taken with the RGS instrument . By using the ratio of fluxed EPIC-pn and RGS spectra , we were able to put tight constraints on the variability of the absorbers . Monitoring with the Swift satellite started six weeks before the XMM-Newton observations . This allowed us to use the history of the ionising flux and to develop a model for the time-dependent photoionisation in this source . Results : Components A and B are too weak for variability studies , but the distance for component A is known from optical imaging of the [ O iii ] line to be about 3 kpc . During the five weeks of the XMM-Newton observations we found no evidence of changes in the three X-ray dominant ionisation components C , D , and E , despite a huge soft X-ray intensity increase of 60 % in the middle of our campaign . This excludes high-density gas close to the black hole . Instead , using our time-dependent modelling , we find that the density is very low , and we derive firm lower limits to the distance of these components . For component D we find evidence for variability on longer time scales by comparing our spectra to archival data taken in 2000 and 2001 , yielding an upper limit to the distance . For component E we derive an upper limit to the distance based on the argument that the thickness of the absorbing layer must be less than its distance to the black hole . Combining these results , at the 90 % confidence level , component C has a distance of > 70 pc , component D is between 5–33 pc , and component E has a distance > 5 pc but smaller than 21–400 pc , depending upon modelling details . These results are consistent with the upper limits that we derived from the HST/COS observations of our campaign and point to an origin of the dominant , slow ( v < 1000 km s ^ { -1 } ) outflow components in the NLR or torus-region of Mrk 509 . Conclusions :