Respected scholars, as-salamu `alaykum.
I totally forgot that I was fasting and had a cup of coffee when I got to work. Will this break my fast?
Jazakum Allahu khayran.
If you did so forgetfully, then it did not break your fast, as long as you stopped it [eating and drinking] from the moment you remembered that you were fasting. If, on the other hand, you continued to do so even after remembering, then, of course, your fast was broken and you have to make up for the same by fasting another day.
Abu Hurayrah reported that Prophet Muhammad (peace and blessings be upon him) said, "If somebody eats or drinks forgetfully, then he or she should complete fasting, for what he or she has eaten or drunk has been given to him by Allah" (Al-Bukhari and Muslim).
Based on this, scholars are of the opinion that eating or drinking forgetfully does not invalidate one's fast. It goes without saying that one must immediately abstain from doing so as soon he or she becomes conscious of it.
In conclusion: Your fast is not broken as long as you did not consume anything after recognizing that you are supposed to be fasting.