Coffee colored semen or even rust colored semen is usually caused by blood in the semen, which is termed Hematospermia and can be caused by several different things. It can be caused by things like Prostatitis (inflammation of the prostate gland), urinary tract infection, epididymitis, ejuaculation duct obstructions, cysts, STD's, urethritis (inflammation of the urethra-the passageway for urine to exit the body), and medications that cause thinning of the blood (like Heparin, Lovenox, and even long term use of Aspirin). Also, a long abstinence from sex or trauma to the penis or scrotum can also cause this problem, and from having procedures like vasectomy.
Pain or continued blood in the semen usually warrants a trip to the Dr. He/She will most likely rule out anything kidney or urinary tract related first, and then will most likely rule out STD's and then give you a good physical exam. Some men will have blood in their semen for no apparent reason and it will not cause pain and go away on it's own, however, with the pain, I would seek medical attention.
The treatment will depend upon the cause and this will usually be determined by urinalysis and culture and possibly x-rays. If there is an infection, antibiotics are used. The exact cause must be determined before the proper treatment can begin.
Your $$$ that you have put down as a deposit will not go to me unless you click ACCEPT. JustAnswer.com will hold your deposit and it will not be released to me for my efforts and time. So please remember that if my answer has provided some insight or information, please click ACCEPT so that I can continue to help others. Let me know if more clarification is needed.