Images of the CMB show no sign of stars or galaxies. If they did, shouldn't the Milky Way be a bright band dividing the CMB into hemispheres? Black body radiation in a given wavelength/frequency range gets more intense as the object in question gets hotter, so we can't say stars are too hot to glow in the microwave range. Are they just too few and far between to have a noticeable effect?
The raw data does show that. However, the sky is surveyed in multiple frequency bands, and the foreground and background are visible to varying degrees in each. WMAP, for example, has 5 bands, here's two of them (more here).
To give a simplified explanation, these are combined as a weighted average with the bands that show the galactic contribution more prominently given negative weights to subtract that contribution out. For example, say you have three measurements that in one band are:
1 3 1
And in another band are:
1 2 1
Give the first a weight of -1 and the second a weight of 2, and the weighted linear combination is:
1 1 1
...and you've subtracted out the strong "foreground" signal in the middle. Of course, what you have is now a mix of wavelengths, so this isn't without loss.
What they actually did is a bit more complicated, using different coefficients for different parts of the map and some smoothing to eliminate discontinuities. This paper goes into much more detail into this and some other approaches.