We present a method to perform in situ microrheological measurements on monolayers of soft materials undergoing viscoelastic transitions under compression. Using the combination of a Langmuir trough mounted on the inverted microscope stage of a laser scanning confocal microscope we track the motion of individual fluorescent quantum dots partly dispersed in monolayers spread at the air-water interface. From the calculated mean square displacement of the probe particles and extending a well established scheme of the generalized Stokes-Einstein relation in bulk to the interface we arrive at the viscoelastic modulus for the respective monolayers as a function of surface density. Measurements on monolayers of glassy as well as nonglassy polymers and a standard fatty acid clearly show sensitivity of our technique to subtle variations, in the viscoelastic properties of the highly confined materials under compression. Evidence for possible spatial variations of such viscoelastic properties at a given surface density for the fatty acid monolayer is also provided