You can stick a thermometer in space, and if it is a super-high-tech one, it might show you the temperature of the gas. But since the interstellar medium (ISM) is so dilute, a normal thermometer will radiate energy away faster than it can absorb it, and thus it won't reach thermal equilibrium with the gas.
It won't cool all the way to 0 K, though, since the cosmic microwave background radiation won't allow it to cool further than 2.7 K, as described by David Hammen.
The term "temperature" is a measure of the average energy of the particles of a gas (other definitions exist e.g. for a radiation field). If the gas is very thin, but particles move at the same average speed as, say, at the surface of Earth, the gas is still said to have a temperature of, say, 27º C, or $ 300,mathrm{K}$.
The ISM consists of several different phases, each with their own physical characteristics and origins. Arguably, the three most important phases are (see e.g. Ferrière 2001):
Molecular cloudsStars are born in dense molecular clouds with temperatures of just 10-20 K. In order for a star to form, the gas must be able to collapse gravitationally, which is impossible if the atoms move too fast.
The warm neutral mediumThe molecular clouds themselves form from gas that is neutral, i.e. not ionized. Since most of the gas is hydrogen, this means that it has a temperature of roughly $10^4,mathrm{K}$, above which hydrogen tends to get ionized.
The hot ionized mediumGas that accretes onto the galaxy in its early phases tend to have much larger temperature, of roughly $10^6,mathrm{K}$. Additionally, the radiative feedback from the hot stars (O and B), and the kinetic and radiative energy injected by supernova explosions ionize and heat gas bubbles that expand. This gas comprises the hot ionized medium.
CoolingThe reason that the ISM is so sharply divided into phases, as opposed to just being a smooth mixture of particles of all sorts of energies, is that gas cools by various physical processes that have a rather temperature-specific efficiency.
"Cooling" means converting the kinetic energy of particles into radiation that is able to leave the system.
Hot gasVery hot gas is fully collisionally ionized and thus cools mainly through free electron emitting Bremsstrahlung. This mechanism becomes inefficent below $sim10^6,mathrm{K}$.
Warm gasBetween $10^4,mathrm{K}$ and $10^6,mathrm{K}$, recombinations (i.e. electrons being caught by ions) and collisonal excitation and subsequent de-excitation lead to emission, removing energy from the system.
Here the metallicity$^dagger$ of the gas is important, since various elements have different energy levels.
Cool gasAt lower temperatures, the gas is almost fully neutral, so recombinations cease to have any influence. Collisions between hydrogen atom become too weak to excite the atoms, but if molecules or metals are present, it is possible through fine/hyperfine lines, and rotational/vibrational lines, respectively.
The total cooling is the sum of all these processes, but will be dominated by one or a few processes at a given temperature. The figures below from Sutherland & Dopita (1993) shows the main cooling processes (left) and the main cooling elements (right), as a function of temperature:
The thick line show the total cooling rate. The figure below, from the same paper, shows the total cooling rate for different metallicities. The metallicity is a logarithmic scale, so [Fe/H] = 0 means Solar metallicity, and [Fe/H] = –1 means 0.1 times Solar metallicity, while "nil" is zero metallicity.
Since these processes don't cover equally the full temperature range, the gas will tend to reach certain "plateaus" in temperatures, i.e. it will tend to occupy certain specific temperatures. When gas cools, it contracts. From the ideal gas law, we know that the pressure $P$ is proportional to the product of the density $n$ and the temperature $T$. If there's pressure equilibrium in the ISM (which there isn't always, but in many cases is a good assumption), then $nT$ is constant, and thus if a parcel of hot ionized gas cools from $10^7,mathrm{K}$ to $10^4,mathrm{K}$, it must contract to increases its density by a factor $10^3$. Thus, cooler clouds are smaller and denser, and in this way the ISM is divided up in its various phases.
So, to conclude, interstellar space is not as cold as you may think. However, being extremely dilute, it is difficult to transfer heat, so if you leave your spaceship, you will radiate away energy faster than you can absorb it from the gas.
$^dagger$In astronomy, the term "metal", refers to all elements that are not hydrogen or helium, and "metallicity" is the fraction of gas that consists of metals.