Inspect the key underneath to see if it looks broken anywhere. If not keep trying to reattach it, some apple keys can be fiddly to put back on, even to a seasoned pro.
If its broken, call up Applecare and get them to agree to cover it under warranty before taking it for repair.