"Play the piano/violin/trumpet" (in a general sense) is an idiom: it does not imply a particular piano (violin, trumpet). So
I can't play the piano but I'd like one.
makes sense ("one" = "a piano")
I can't play the piano but I'd like it.
is at best ambiguous ("it" cannot mean "the piano", because the idiom does not specify a particular piano).
"The" is required in British English, but optional ("play piano") in American English: see Separated by a Common Language - she also discusses why this "the" is found.
Edit: Murat Can OĞUZHAN asks about 'The' in "The giraffe is my favourite animal.
To repeat my comment, "the giraffe" is a normal (though somewhat old-fashioned and literary) use of "the": "used to mark a noun as being used generically" - definition 5 here.
At first I thought this was a different phenomenon from "play the piano", particularly because almost all uses of generic "the" are in the subject position: I don't think anyone would say "I love the dog" to mean dogs in general. (I'm not sure about the acceptability of "Today I'm going to talk about the dog").
But I'm coming round to the view that it is the same. I can't find a difference between
The giraffe is my favourite aninmal.
The piano is my favourite instrument.
But there is still a difference in non-subject position.
I love the piano.
is normal, but
I love the giraffe.
is odd, to my ears, in the generic sense.