What is a word for using an attribute of a thing to refer to the whole thing?
Two terms are used: metonym and synecdoche.
A synecdoche is a figure of speech where a part of something is used to refer to the whole of it.
A metonym is a broader category. Wikipedia notes that some people consider synecdodches to be a specific subcategory of metonyms, while other consider them to be distinct (similar to the relationship between similies and metaphors). In either case using associated words would be classified as metonyms, such as saying "the White House" to refer to the US president and his staff.
Pars pro toto
Latin for "a part (taken) for the whole", is a figure of speech where the name of a portion of an object, place or concept represents the entire object, place or concept. It is distinct from a merism, which is a reference to a whole by an enumeration of parts, metonymy, where an object, place or concept is called by something or some place associated with the object, place or concept, or synecdoche, which can refer both to this and its inverse of the whole representing a part.