Amazon.com Inc abruptly scrapped plans to build a headquarters in New York after opposition from local politicians and some of its would-be neighbors, the third most-valuable public U.S. company said on Thursday.