First, meetings are not a distraction from work. If you are being asked to attend meetings, they are part of your work. So treat them with the same professionalism you bring to your other work tasks.
Managing your meeting workload is a critical skill as you get beyond the trainee level. Learning how to run an effective meeting is a skill beyond price.
Meetings fall into several categories and handling them appropriately depends on the category. For example:
Client Meetings (including internal clients)
It is very difficult to avoid these meetings once you start getting invited to them. However, these meetings are precisely the ones you want to attend if you want to influence what will be done in a project. These are the meetings where you will make the client aware of how good you are and earn their trust. Anyone who can earn the trust of a client and sell them more of your product as a result is priceless. Therefore effectively attending these meetings is a good career move.
So don't blow these off or spend them working on code or other tasks. Pay attention, speak up when there is a chance to say something worthwhile and make sure the client gets a good impression of you.
If the client calls too many of them though, the best defense is that you need to be working on XYZ which has deadline of ASAP. If you are doing something that is clearly to their benefit, they are more willing to let you out of the meeting. Another tactic that the less senior person can take is to say that they will be available for consultation during the meeting period if the client needs information from them. That way you can work and get added into the teleconference if something comes up that only you can answer and you don't have to listen to the rest of the meeting. Another tactic is to ask to cover your information first, so that you can leave to go work on their deliverable.
I have found it is far easier to escape unneeded client meetings once you have won their trust. Part of why they are calling so many meetings is that they don't trust you to deliver their product on time and meeting the requirements. So start by paying attention and figuring out why they are unhappy. Then start to take the initiative to fix whatever they perceive as wrong.
General Business/HR meetings
These are generally timewasters that you can avoid unless they are made required. Really, if you don't have any questions about the new health insurance plan or how the 401K works, you can escape. A good way to escape is to tell your boss that attending will have an impact on delivering the XYZ product by ABC date and that the schedule would need to slip as a result.
General team, department, division meetings are often required as a vehicle to pass out corporate news, although if you don't abuse it you can often get the manager to give you a quick briefing after the meeting if you are involved in a project with a close deadline. Generally to keep our billable percentage of hours up, we aren't allowed to spend more than a half an hour a week in these kind of general team meetings. So you can use that as an argument to limit the time you spend on them if you need to.
Scheduling a client meeting at the same time (It was the only time they could meet) will work wonders in getting rid of some of these too.
Ones with no announced subject and no notice that are required are another matter, these generally fall into the category of the announcement of a layoff or a major business change (outsourcing or being bought by a another company) that could affect your day-to-day operations. Further, your lack of attendance will be noticed. And really after some of these meetings whatever you were working on becomes irrelevant anyway.
Technical design meetings
These are the kind of meetings that can actually be fun. You get to influence more than just your small part of the project. You get to hear other people's ideas which may teach you some new tricks. Generally these are less formal and involve a lot of writing on a whiteboard. Try to get invited to these. An hour of tossing around ideas before you code can save a lot of time down the road when it is time to start coding. Regular invitations to these sorts of meetings shows you are respected as a professional in your field. If these start getting out of hand, start volunteering to run the meeting. Then you can keep it on track and keep the time down to a reasonable amount.
The bane of our existence. Pretty much everyone, except senior managers, hates progress meetings. However, without them, it is sad but true, many projects would never make any progress. SCRUM requires daily stand-ups just for that reason. Not only do you know everyday where the project stands, you can easily see who isn't making progress or get people reassigned to areas that need help. If you have to attend these (and chances are good you will have to if you are involved in any type of project work), then at least pay attention, you might find that George is doing something that will affect what you are doing. Now just because you aren't the person who called the meeting doesn't mean you can't step in to lead it if it is going off into the weeds. Almost everyone will appreciate someone who puts the meeting back on track and gets them out of there. Keep a stock list of phrases that will help move this stuff along such as:
"Joe and Mary, you two clearly need to work out some details without the rest of us, why don't you two get together after this meeting and report back at the next meeting."
"Can I go ahead and talk about XYZ now as I need to go to another meeting after this one?"
" I think we have gotten off track, we are here to discuss XYZ, let's stay with that. Bill if you need to discuss FGH then please call a meeting of the people involved only in that later today."
A well-timed request for a bathroom break can give you the opportunity to realize that this critical email came in while you were in the meeting and that you must leave to attend to that urgent issue. Sometimes, just asking for a bathroom break will allow everyone to say they need to continue at a later, unspecified time. Don't do this in a meeting that has gone on less than an hour however.
Do not work overtime just to make up for lost time due to meetings. Adjust the project schedules if meetings take up too much time. This step alone will make people more aware of the impact of too many meetings.
If you feel you are invited to meetings you have no need to attend, then ask the person in charge of the meeting what he or she expects you to bring to the table. Sometimes a five minute conversation before a meeting can get you out of it.
Also, if the people keep inviting you when you you don't think you should be there, then get your boss involved in getting you out of those meetings. Remind him that every minute you are attending a meeting to discuss why it might be nice to do ABC next year, you aren't making progress on DEF that is due right now.
But if he says ABC is a higher priority, then it is. Just don't enable managers by working an extra 20 hours to make up for the lost 20 hours of meeting time. If they say the meeting is the priority, then it is the priority and the other work will slip just like when they add a new important feature and the less important one gets bumped down the list.