2 prong extension cords are safe to use.
The 2 prong indoor extension cords are safe to use indoors with 2 prong plug in appliances and electronics, lamps etc.
You don't always need a ground plug on an extension cord or other cord unless you're really working in wet conditions etc.
It's always good to use power tools with a 3 prong extension cord that is grounded to prevent electric shock as the ground helps to trip the breaker if you get shocked or the electric cord gets into water etc.
But 2 prong extension cords without the ground are safe to use.
Even 2 prong outlets in older homes are also safe to use and are up to code if they have been already installed.
However if possible it's best to replace the wiring and outlets in your home with 3 prong grounded outlets.
I use 2 prong indoor extension cords all the time and have done so for years as well as many other people have and they are safe.
Just make sure the extension cord is not frayed, cracked or missing any insulation and is not getting hot.
Also make sure the plug is fitting tightly into the wall outlet as loose electrical connections can cause fires.