The term Cockney specifically refers to someone who is born within the sound of the Bow Bells, which is the area around the church of St Mary-le-Bow in the East End of London. Traditionally, Cockneys were associated with the working class communities of this area and are known for their distinctive accent and rhyming slang.
Hammersmith is a district in West London, and while it is part of the Greater London area, it is not within the traditional boundaries of the East End. So, someone born in Hammersmith would not be considered a Cockney in the traditional sense.