So you bought the car new or used?
If new, you should have 3 keys(2 maste+1 valet). If used, it depends on what the last guy gave you.
If you have 2 working keys, it's simple to get a 3rd key programmed to the car. (A dealer tech can do it in 5 minutes). This is simple because it's assumed that since you have 2 known keys you're the owner of the car.
If you only have 1 working key, then you need a key cut by the dealer (which they can do by the vin# of the car) and then they need to have the car learn the keys. Since you only have 1 known key, there is much more effort to program new keys to the car because of theft prevention measures, and the dealer doing the programming is supposed to verify ownership of the vehicle before programming new keys to the ignition.
Hope that helps
cBob
Edit: Atlest it was from my understanding. Mazda recenetly changed to the "pocket knife" style key, and it could be they only give out 2 keys due to cost of manufacturing or whatnot.