Falling short of the two-thirds majority needed, Republicans backers of the pipeline could not peel off enough Democratic supporters to join them. The vote was 62-37, with all Republicans and eight Democrats in favor.
The outcome was the latest setback for the GOP-led Congress, which made passage of Keystone a top priority. It served up a victory for the White House on the first major veto of Obama's administration.
"For a long time, projects like Keystone used to be no-brainers -- they were often approved without much controversy at all," said Senate Majority Leader Mitch McConnell (R-Ky.), who made the bill the first order of business when he took control of the chamber in January. "But that was before powerful special interest groups and ideological extremists decided to embark on a quixotic quest."
Noting the significance of the override attempt, McConnell asked senators to take the roll call vote from their desks, a rare practice reserved for landmark votes.
Democratic opponents said halting the project was the right decision. Critics if the pipeline argue it would prolong energy dependence on fossil fuels and worsen climate change.
"Why would we build a pipeline to bring filthy, dirty oil to our great nation, to our communities?" asked Sen. Barbara Boxer (D-Calif.). "The only thing it helps, frankly, are the special interests in Canada."
In many ways, the debate over the Keystone project has become more about politics than substance, as rhetoric on both sides escalated.
The vote also showed the limits of the new Republican Congress in the face of the president's veto power, which was rarely used when Democrats controlled Congress.
The $8-billion project proposed by the TransCanada Corp. would carry oil from the tar sands of Canada's Alberta province through the U.S. heartland.
The Obama administration might still approve the project. But the White House opposed the attempt by Congress to expedite approval, especially while a court case is underway in Nebraska, where the path of the pipeline splits to run east through Missouri and south to the Gulf Coast.
Both the House and Senate passed the bill earlier this year to push approval after years of delay. Many Democrats joined the Republican-led effort.
Supporters said the project would create needed American jobs, and a federal review said more than 40,000 direct and indirect jobs would be created during pipeline construction. Later, however, there would be only 35 permanent U.S. jobs during pipeline operation, the review said.
As oil prices tumbled last year, some experts questioned whether the pipeline project made financial sense. Backers insist the project will continue.
With the outcome in the Senate, rules prevent the House from taking its own override vote.