This could easily be different from country to country or region to region, but I think I would generally use "coffee" instead of "a coffee" in most of those examples. If I were going to a coffee shop for "a coffee" though, I might use the second example, but it could easily be "coffee" or "a coffee". Regardless, I agree that leaving out "cup of" isn't necessarily improper.
I'm an English teacher, and this is one that my students have a hard time with because Americans speak so informally (ie. the examples you provided), so I'm very familiar with un-count-ables. The sentences that you provided are not grammatically correct, and since they are, in fact, used informally, that would make them slang. 'a coffee' could mean a thimble full of coffee or a bathtub full of coffee and until you specify which vessel it is in, it's not grammatically correct. Either way, 'a cup of coffee' should be accepted on a language learning platform.
I'm English, in my experience 'A coffee' is far more likely to be used and anyone saying 'A cup of coffee' would be considered odd in most situations. The members of You'd only stipulate the volume if it were something other than a cup. So in Starbucks I'd say Venti and in Costa Massimo; in a cafe where there was a choice of cup, mug or jug I'd say Mug but if I didn't specify the volume then I'd expect whatever the middle size they offered was.
Interesting historical note, many German spies dropped into the UK during World War II were identified because they used formal English because that was what they had been taught.
If a Romanian came to the UK to do business and said "A cup of coffee" rather than just "A coffee" would be met with some puzzlement in many situations as the English native speaker would be wondering what they thought their coffee would come in. A shoe?
This does relate to a concern I have about learning a language, am I learning the language as it is actually spoken or some academic ideal that would make me sound like either some nouveau riche pretender or an overly florid 17th century romance novel?