I have had pneumonia for 3 weeks no medicine is working and now I can't take a breath without extreme pain. What could be going on?

Need follow up. If you have not had a follow u with your doctor, it seems like it may be time. You may benefit from a pain medication. I know it may hurt to breath but you need to to keep your airway open. Your doctor can help by giving you a spirometer which can help you take deep breathes.
Empyema. There are many possibilities in this situation and this question can not be answered specifically in this forum. You should speak with your doctor. One potential problem that can occur is that the infection spreads to involve the space surrounding the lung, called the pleural space. The resultant infection is called an empyema, and if present the space needs to be drained.