There are 50 states in Europe, whereas 27 are Union members. Some non-members, the micro states as @Darwin said, are in the EEC or enjoy the benefits of EU through bilateral agreement with surrounding countries.
It is a bit more complex than to just join. In order to do so a country has to meet the Copenhagen Criteria and not have capital punishment, as the Union is abolitionist. There is also a geographic criteria that could be up for debate.
Any European country could apply to join the EU, as Iceland recently did. This application will either be accepted or rejected by the European Council.
For a country to become an EU member state, it must first apply. Further, it must have achieved a stable democratic system, respect for human rights – the existence of a competitive market economy, and the ability to adopt the EU law, the Acquis, which embodies laws of the treaties – in order to become a Candidate Country. Belarus don’t qualify, for one, due to having capital punishment, and Russia will not become a member.
EU have enlargement processes, where it deems it is ready to accept new members. The Fifth Enlargement of the EU was carried out 2004–2007. The existing enlargement agenda encompasses the Croatia, Macedonia and Turkey. These countries have been offered the opportunity to become EU members in the near future, and have the status as candidates.
Once a candidate, the Union and the candidate starts a negotiation process which is carried out in many steps, in order to integrate the country with the Acquis. Turkey, however, does have some democratic problems and with the treatment of minorities, which must be resolved.
Countries like the Ukraine, Georgia and Azerbaijan might be future members, as well as Armenia. There are voices for countries like the Cape Verde islands and Israel to join. The geographic criteria is not legitimate in itself, as non-european territory is part of the Union already. French Guyana in South America, for instance, is a part of the EU as is Reunion outside of Madagaskar. These are however pre-existent parts of member countries, but is an argument in favor for non-european countries to join.
The Union also cooperates with the surrounding neighbour countries in the European Neighbourhood Policy. This includes north Africa.