There are taxis 24/7... simply walk to the front of Estació de França, there's a taxi rank there -incidentally, in front of the station there's a cafe that's open also all night long and it's one of the classic meeting points for taxi drivers in the night shift. You could also just wait at any major street and soon enough an available taxi will pass by (those with the green pilot on the roof on -simply hail them). There are 11000 taxis in the city -not sure how many doing the night shift, but a lot of them, for comparison, NY city has 4 times the population of Barcelona and just 13000 taxis. Ah yes, all taxis in the city are painted the same: yellow and black.
As per how early... I would be cautious and be there extra-early because these past two weeks the airport has been (still is!) in a "rough patch" with the new EU border checks and the boycott of the Spanish government to this airport by purposely not increasing the Spanish Police staff -the only ones authorised to do the checks. There have been very long queues with the Police booths severely understaffed so the normal 1h for European flights, 2h for overseas flights recommendation needs to be greatly increased to make sure you don't loose your flight should you get stuck in one of those queues... should you stumble into one. The driving from the area of El Born to the airport at those hours shouldn't take more than 30' -give or take.
PS. Long story short, it has to do with political tensions between the Spanish and the Catalan governments ahead of the independence referendum to be celebrated later in the year. If particularly interested in the reasons of this "episode" at the airport, just take a look at the press these days (example here, use Google Translate)