"The" se usa cuando se está hablando de algo específicamente.
"The" is used when you're talking about somthing specific.
En el caso de "the cup of coffee", se está hablando simplemente de una taza de café cualquiera. Pero si escriben "the cup of the coffee", se está hablando de un café del cual se habló antes en la conversación. Ejemplo: "There is a cup with coffee, and another one with tea. That is the cup of the coffee" (Aquí hay una taza con café, y otra con té. Aquella es la taza del café.)
In the case of "the cup of coffe", we are talking just about a cup of any coffee. But, it you say "The cup of the coffee", you're talking about a specific coffee the one you mentioned before. For example. "There is a cup with coffee, and another one with tea. That is the cup of coffee"