First, you really need to do some research to understand your boss's strengths and weaknesses and why he's in the position he's in. It's important to know if he may be an ally to someone at the top, or may have some value that's not related to his current job.
Knowing this will help guide your response, but in general, there are two things you want to be doing. The first is to recognize where your boss is weak and attempt to compensate for it. Do work that protects his backside but make sure he gets credit for it. In some sense, you want to save him from his own mistakes, which reflect downward on everyone, including you. But you also want to make sure he doesn't view you as a threat and subsequently try to block your progress.
The second thing you should be doing is seeking out every possible opportunity to meet people above and beyond your boss, and appropriately showcasing your strengths to them. Your boss's boss, for example, should have a good idea of what you're doing and how well you're doing it. This person and others around your boss likely realize that your boss has some difficulties, and so you want them to know what you're doing to help him and work around him in a sensitive manner. This will reflect well on your management skills, as well as help you develop allies should you eventually attempt to switch to another group within your company.
One of my former clients was a manager at a pharmaceutical company who had an ineffectual boss. For whatever reason he was beloved there and was able to keep his job, so my client did everything she could to prop him up. While she made an effort to always thank him publicly in front of larger staff groups, most of the real decision-making was done by her as she consulted with and got support from the people around and above him. And she made sure those people were aware of what she was doing. Once some key decisions were made, she would go to her boss and frame the situation almost as though he were blessing the decision, which made him feel involved and unthreatened by her. The fact that she handled the situation so well stood out, though, and was critical to her next moves upward at the company.
Read More Power Plays From Ron Brown:
How Can I Find Out What's Really Going on at My Company?
Help! My Boss Keeps Changing Priorities on Me
How Should I Manage a Resentful Colleague?
Help! My Colleague Is Trying To Sabotage Me
Help! My Boss Is Micro-Managing Me!
Send Ron your career and job-related questions.