Questions & Answers about Я хочу чай, а не кофе.
They are functioning as the objects of хочу. In modern Russian, that usually means the accusative.
For this sentence:
- чай is masculine inanimate, so its accusative singular looks the same as the nominative: чай
- кофе is an indeclinable noun, so it also stays кофе
So even though both words look unchanged, they still fit the grammar of the sentence.