The rule is that there is a one hour fast from all food and liquids before Communion (not before Mass). The only exceptions to this rule are water and medicine. Those who have medical conditions that make such a fast dangerous are exempt from the fast. If you can finish your coffee at least one hour before Communion, then it is fine to drink it on the way to church. Otherwise, coffee does break the Communion fast.