Reposting what I wrote in another thread in TravelBuzz when another user asked basically the same question, specific to MAD-CDG-BOS versus just CDG-BOG:
Airfares are based on market demand as a city pair and competition factors, not what it cost to transport the passenger from A to B. Madrid to Bogota is a different market than Paris to Bogota. Additionally, Air France flies Paris to Bogota nonstop, giving AF a competitive edge over most competitors on the route, which AF capitalizes on. AF only faces nonstop competition from Avianca on CDG-BOG. All other competitors require a connection, making them a less ideal option than AF. Conversely, on MAD-BOG, AF has to compete with 1-stop options against 4 airlines offering nonstop flights from MAD to BOG while also having to compete with numerous competitors who offer 1-stop competition. AF knows that it is a less ideal option due to the connection being required on MAD-BOG and has to price its product accordingly.
There are also numerous other factors. You may find if you put in MAD-BOG on Iberia, it's more expensive than CDG-MAD-BOG on Iberia. That said, IB is also weighing its own factors and comparing expected demand to actual demand (bookings) to determine if it should raise or lower fares.