Context. HD54879 (O9.7 V) is one of a dozen O-stars for which an organized atmospheric magnetic field has been detected. Despite their importance, little is known about the winds and evolution of magnetized massive stars. Aims. To gain insights into the interplay between atmospheres, winds, and magnetic fields of massive stars, we acquired UV and X-ray data of HD54879 using the Hubble Space Telescope and the XMM-Newton satellite. In addition, 35 optical amateur spectra were secured to study the variability of HD54879. Methods. A multiwavelength (X-ray to optical) spectral analysis is performed using the PotsdamWolf-Rayet (PoWR) model atmosphere code and the xspec software. Results. The photospheric parameters (T∗ = 30:5 kK, log g = 4:0 [cm s-2], log L = 4:45 [Lo]) are typical for an O9.7 V star. The microturbulent, macroturbulent, and projected rotational velocities are lower than previously suggested (ϵph; vmac; v sin i ≤ 4 km s-1). An initial mass of 16 Mo and an age of 5 Myr are inferred from evolutionary tracks. We derive a mean X-ray emitting temperature of log TX = 6:7 [K] and an X-ray luminosity of LX = 1 × 1032 erg s-1. Short- and long-scale variability is seen in the Hα line, but only a very long period of P ∼ 5 yr could be estimated. Assessing the circumstellar density of HD54879 using UV spectra, we can roughly estimate the mass-loss rate HD54879 would have in the absence of a magnetic field as log ?MB=0 ∼ -9:0 [Mo yr-1]. The magnetic field traps the stellar wind up to the Alfvén radius rA & 12 R∗, implying that its true mass-loss rate is log ?M ≤ -10:2 [Mo yr-1]. Hence, density enhancements around magnetic stars can be exploited to estimate mass-loss rates of non-magnetic stars of similar spectral types, essential for resolving the weak wind problem. Conclusions. Our study confirms that strongly magnetized stars lose little or no mass, and supplies important constraints on the weak-wind problem of massive main sequence stars.