First, ask the lab. It's often important to get blood work when you haven't eaten for a certain amount of time, which for convenience is done early in the morning. That's rarely relevant for urine tests. So ask either the doctor or the lab how important it is that you show up without having had a morning pee.
Second, reduce that "several hours" however you can. Ask if you can have the test done at a lab closer to your home, or on a weekend, or in some other way remove the constraint that is requiring you to hold it for so long. Shower the night before. Get someone else to take over your morning duties so you can go straight to the lab, deliver your sample, then return to have a normal day.
Third, if you really must travel for hours to reach the lab and they really insist you cannot pee after midnight the night before or some such thing, then reduce fluids the night before, do not have morning coffee or any caffeinated drink (it's both extra liquid and a diuretic) before you get to the lab, and wear the loosest clothes you can wear in public. Stand rather than sitting to reduce bladder pressure, and when you feel you cannot resist the pressure, focus on breathing in and out to get you through it minute by minute. The urge will generally pass after a few minutes, and not come back for a while.
Fourth, assuming you're not a woman trying to become pregnant, count your lucky stars: this is the group that gets the most "we need the first pee of the day" as well as "please show up with a full bladder" appointments. If you are, well, all I can say is by the time you've been a parent for 5 years, you'll look back fondly on having to hold your pee for a few hours in the morning before a lab appointment :-).