D&D's 4th Pillar
As a game master, it's frustrating when you've put considerable time into preparing a session only to have it canceled in the 11th hour. But there are right and wrong ways to handle it in the moment and in the long run.

My last session left off with a huge cliffhanger, right near the end of a boss battle. The tide was turning in the party's favor but did the long-time foe have any other cards to pull? During tonight's game, we'll find out. Or rather, we won't. Two hours before game-time, 2 out 3 players had to cancel.
We all face the 4th pillar of tabletop roleplaying games like Dungeons & Dragons: scheduling. As a game master, it's frustrating when you've put considerable time into preparing a session only to have it canceled in the 11th hour. But there are right and wrong ways to handle it in the moment and in the long run. With tact, we can build and maintain good relationships with players. With a strategy, we can make our games more resilient in the long run.
Player(s) Cancel, What Now?
Some of your players have canceled. So what happens now? Most importantly, start with the most generous interpretation for the player(s) that canceled. Instead of assuming they don't appreciate you or the game, believe that they might really have something going on that they needed to adjust their schedule. NPCs aren't the only ones with complex lives.
What about someone with repeated cancelations? Again, most generous interpretation. Life is messy. If you really are concerned that someone isn't able to prioritize the game and people involved, have a conversation with them. But approach with curiosity and grace. They've probably got more going on than you know.
But that doesn't have to be the end. Depending on how much time you have and how many players still willing to play, you might have options. With a few hours or days before the session, you can spin up a kickass one-shot or try a new system. If you run shorter sessions, you might only need a half hour to reframe your prep for the available players. Only one player left? Dive into a flashback scene or a one-shot that explores another area of the world. If you're bold enough, just show up with nothing prepared and see where the winds of creativity and collaboration take you.
Building a Resilient Campaign
While these options are great, most of us just want to keep our campaigns moving as much as possible. Here are some ideas for building out a more resilient campaign.
Minimum player threshold. Choose the minimum number of players you're willing to run the campaign for. Communicate with your group that "as long as X number of players can make it, we play." Don't break that rule or it becomes just a suggestion.
Same day, same time. Keep your games on the same day (whether weekly, biweekly, monthly, etc) and at the same time as often as possible.
Schedule one month out. With our without a consistent schedule, keep the next month's worth of sessions on everyone's calendars. This lets them block off that time and plan other things around the game.
Backup campaign. If not everyone can be there, switch tracks to a backup campaign. Everyone can have a character for this campaign and whoever makes it gets to play. This can be an exciting change of pace to buffer the occasional cancelation. To keep your main campaign "on the rails," this backup campaign can take place in the same time and area. Explore different locations and conflicts!
Players are human. Game masters are human. Sometimes we need to cancel. When we handle that with grace and understanding, we strengthen the bonds at our table. With the right strategies, we can avoid complete cancelations and keep our resilient campaigns moving forward.
Game on.