Definition
To “play gooseberry” is a British idiom meaning to be an unwanted third person when two other people, particularly two who are having a romantic relationship, wish to be alone together (Oxford English Dictionary).
Ron Weasley refers to Scorpius Malfoy as "playing the gooseberry", when he reports that he had seen Scorpius standing next to Albus Potter, who was with an "older girlfriend" (CC3.17).
Commentary
Etymology
The origin of the gooseberry role is a matter of speculation. One theory is that the third person is a chaperone, who plays with or counts gooseberries while the two lovers carry on.
It is not known whether the "goose" portion of the word comes from a lost association with geese as birds or if it derives from either Old French groseille (berries) or Dutch kruisbes (gooseberry).
Notes
The American equivalent is to be a "third wheel".
This is also related to the proverb "Two is company, three is a crowd".
From the Web
About the play: http://www.harrypottertheplay.com
Pottermore: http://www.pottermore.com/cursed-child