A compound noun is a noun phrase made up of two nouns, e.g. bus driver, in which the first noun acts as a sort of adjective, a classifying adjective, for the second one, but without "really" describing it, for instance, the difference between, for instance, a black bird and a blackbird.
It can be made up of two or more other words, but with a single meaning. Compounds may, or may not, be hyphentated and they may be written separated, especially if one of the words has more than one syllable, as in living room, or if compounding creates a weird-looking word - so we write car keys, not *. In that regard, it's necessary to avoid the over-simplification of saying that two single-syllable words are written together as one word. Thus, tablecloth but table mat, wine glass but wineglassful or key ring but keyholder. Moreover, there are cases which some people/dictionaries will write one way while others write them another way.
When two short words are written together, they always have the word stress on the first syllable, like many two-syllable nouns: A common exception is weekend, which can be stressed in two ways: /wiːkˈɛnd, ˈwiː-/. Curiously, until very recently we wrote (the) week's end, which later became week-end and then our beloved weekend.
There are three typical structures.
 Noun + noun
- the car keys; a bottle opener; a language teacher;
The two nouns can be written separately (taxi driver), separated by a hyphen (story-teller), or as one word (classroom).
This structure is often used in newspaper headlines.
 Noun + preposition + noun
- court of law; dictionary of quotations; hole-in-one; state of mind;
 Noun + 's + noun
- Spain's economy; a hornet's nest;
 Some typical examples
Note: although they may have other functions, the following are all nouns (see last point above).
 Always written together
Some items are always written as one word.
 Two (originally) monosyllable words
- backache; bathroom; blackboard; boardwork; classroom; coursebook; earring; footprint; greenhouse; guidebook; guideline; handbook; handgun; headache; homework; keyboard; laptop; lighthouse; notebook; podcast; seafood; seafront; shellfish; shopfront; smokescreen; spoonful; spotlight; stopwatch; striptease; sunlight; sunset; sunshine; suntan; timeline; timetable; toothache; toothbrush;
- basketball; bellyache; bellyflop; cardholder; fingerprint; heavyweight; holidaymaker; homeowner; householder; hovercraft; leftovers; notepaper; paperweight; paperwork; pillowcase; proofreader; riverbed; spellchecker; sunglasses; takeaway; thunderstorm; timekeeper; undergraduate; underground; underperformance; underwear; wallpaper; waterfall; watermark; weedkiller;
 Always written separately
Some items are always written separately:
 Monosyllable words
- bus lane; bus stop; fast food; front door; hot dog;
- box office; petrol station; shop window; stomach ache; swimming pool; text message;
 Scientific terms
- bed bug - house fly (but not butterfly)
 Written with a hyphen
- catch-all; double-decker; drink-driving; feather-brain; hole-in-one; press-up; rip-off; see-saw; semi-automatic; sit-up; spin-off; take-off; tap-dancing;
 Written in different ways
- eye-witness = eyewitness; mouse pad = mousepad; videoconference = video conference;
Traditionally, certain compound nouns are pluralised by giving the headword the plural form, rather than the the whole thing. However, the traditional mothers-in-law can now also be seen, and heard, as mother-in-laws.
- attorneys general
- poets laureate
- Merriam-Webster Online dictionary
- "Will we ever… get rid of bed bugs?" BBC
- Trask, R. L. Mind the Gaffe (2001), ISBN 0-14-051476-7