The official taxis in Barcelona are black and yellow and they carry a green light on the roof. If you take a look at the windscreen of the taxi you will see a sign when the taxi is free. The taxis should have a taximeter which they turn on as you start the trip and stop it as you reach your destination.
The minimum fare of a taxi in Barcelona is 2 Euro, and the rate per kilometre is normally 1.10 Euro. During nighttime and for trips to the airport higher fees are charged!.