The short answer is your app knows if it is running on IOS3 and doesn't make those api calls. Or as my teacher would say, its magic...
Actually, it's more that the app will detect you're running iOS 3 during installation and will refuse to install at all - it will say you need to update to the latest software in order to install. That's what happened if you tried to install an app using 3.0 APIs on 2.x, and it will be the same with installing 4.0-compatible apps on 3.x.