2-prong cord but 3-prong outlet
As already pointed out, yes you can. But maybe understanding the why will help:

From this article, "https://electronics.howstuffworks.com/everyday-tech/question110.htm"

"The idea behind grounding is to protect the people who use metal-encased appliances from electric shock. The casing is connected directly to the ground prong."

So, chances are the device you are using would not electrocute you if a wire became loose inside and touched the casing. That is why there is not a need for the ground prong.