HZX D882 transistor not blocking 12V DC current
The Part Number you have given tells that it is an NPN transistor. But the way you connected the circuit seems incorrect.
In a switch configuration of NPN transistor, the emitter is usually connected to the ground and the collector is connected to the power source.
The emitter section is identified with the help of the arrow mark marked on the pin in the schematic. The direct opposite section of the emitter is the collector section.
Since you did connect the base of the transistor correctly with the Raspberrypi I hope that you are clear on the base side of the transistor.
The picture below is drawn as you did.

Picture A depicts that your Raspberrypi is not supplying anything to the transistor and the led is in an OFF state.
Picture B depicts that your Raspberrypi is supplying power to the transistor and the led is in an ON state.
To add more, I suspect the resistor value you have chosen and connected in the collector section of the transistor. The resistor connected there is to limit the current flow for the LED to glow on. If you did the calculations correctly, leave it.
If the current flow is higher than the LED need, it will burn the LED and you will see no result from it.
Have a nice day!