At least three Republicans - John McCain, Susan Collins and Lisa Murkowski - voted against the bill, which needed a simple majority to pass.
President Donald Trump said the three had "let the American people down".
The so-called "skinny" repeal, which would have scaled back some of the more controversial provisions, is the third failed attempt to repeal Obamacare.
It would have resulted in 16 million people losing their health insurance by 2026, with insurance premiums increasing by 20%, according to the Congressional Budget Office (CBO).
Obamacare v Republican plan compared
'Don't take away our healthcare' says Trump country
But it was voted down by 51 votes to 49 in the Republican-dominated Senate.
Senate Majority Leader Mitch McConnell, a Republican, described the result as a "disappointing moment".
Democrat Chuck Schumer said his party was relieved that millions of people would retain their healthcare.
The vote had been delayed after Senate Republicans kept a procedural vote open before the actual Obamacare vote while they attempted to persuade their members to vote for the repeal.