The showdown is one of Spain's biggest political crises since the end of the dictatorship of Francisco Franco four decades ago and it has Catalonia deeply divided.
So how did the situation get so out of hand?
Catalan separatists called the referendum on September 6th despite a ban by Spain's Constitutional Court and with little debate allowed in the regional parliament.
Since then, web closures, detentions and the seizure of millions of ballots don't appear to have dampened the enthusiasm of the separatists in this wealthy northeastern region which is home to 16 percent of Spain's population.
When the organisers have been fined thousands of euros, activists have raised funds.
Ballot papers seized?They have called on people to print more.
And when internet sites promoting the referendum are blocked, others re-open.
Determined to block the illegal vote, the state has deployed thousands of police to Catalonia, some of them housed in ferries in the ports of Barcelona and Tarragona.
One of the boats is decorated with giant Looney Tunes cartoon characters, including Tweety.
Cue the hashtag #FreeTweety, which has become a worldwide trending topic on Twitter, the little yellow bird becoming an emblem of Catalans who want to vote.
But the potential independence of Catalonia, roughly the size of Belgium and contributing 19 percent of Spain's economy, is no laughing matter.
The consequences are hard to predict, leading to comparisons with Britain's decision to quit the European Union, which was made at a referendum in June 2016.
"It's like the Brexit, just as stupid," says Beatriz Migens, a 43-year-old from the southern city of Seville, on the high-speed train from Madrid to Barcelona where she spends two days a week for work.
In Madrid, Rodrigo Marrero, a lawyer from the Canary Islands who works in the Spanish capital, says: "If Catalonia left, it would be like losing a limb."
"Everyone I know is dismayed, we talk of nothing else."
For his part Ferran Mascarell, who represents the Catalan executive in Madrid, says there has long been resentment among Catalans who feel that Madrid holds them in contempt.
But the impact of Spain's economic crisis, followed by the Constitutional Court's partial cancellation in 2010 of a statute giving Catalonia greater autonomy, turned this into outright anger, he adds.
"It's the result of a revolt of the middle-class against the state, which isn't doing its job right."
But those who oppose independence, particularly the Ciudadanos party, believe it is about more than that.
They claim that some politicians have used the struggle for independence as a way to divert attention from corruption cases in Catalonia and mismanagement of the region.
'We will vote'
Catalonia has its own language and culture but out of its 7.5 million inhabitants, more than half come from elsewhere, such as those whose parents or grandparents migrated from other parts of Spain.
And on the subject of independence, Catalonia is divided almost down the middle... even within families.
But more than 70 percent of Catalans want to settle the matter once and for all in a legal referendum, according to opinion polls.
Spanish Prime Minister Mariano Rajoy, though, refuses. He has repeatedly said any such referendum would contravene the very Constitution that Catalans overwhelmingly ratified in 1978.
He is also reluctant to open a Pandora's box in a fragile decentralised Spain where regions have differing levels of autonomy.
Still, after managing to emerge from a damaging economic crisis and put a stop to attacks by Basque separatist group ETA, Spain's image has taken a hit.
For weeks, the state, its judges and police forces have pulled out the stops to stop the Catalan vote.
Protests have broken out in Barcelona and other Catalan cities -- all peaceful except that several police vans were damaged.
Firefighters, dockers, farmers and school children have shown their determination with slogans like "Votarem" (Catalan for "we will vote") or "love democracy."
Madrid has however emphasised that even if Catalans manage to vote en masse on Sunday, it will not be a referendum with any semblance of legitimacy.
There is no electoral census, the board set up to oversee the vote has been dissolved, and parties against independence have called on their followers to boycott Sunday's vote.
By Michaela Cancela-Kieffer / AFP