Terrain plays a huge part in defeating legions. For example in the Cantabrian Wars scenario, the Roman legions are in serious trouble against tribal warriors who get nice bonuses when fighting in mountainous terrain.
If you don't have such special troops and special terrain, I've found that it really helps to be on the defensive and try to keep your troops well supplied and under decent commanders, especially if you don't have considerable numerical superiority. If the Romans attack you with poorly supplied troops that have lowered cohesions values, you have good chances of beating them, even when your troops are not as good as the legionnaires.
But if the Romans are led by Sulla, you're doomed.
