I listen to music or podcasts while cycling to/from work everyday, but at low enough volumes that I can easily hear traffic around/behind me. I would not recommend it if you've just started cycling, but if you're comfortable enough on a bike in city traffic it should be okay. Just make sure you're always constantly aware of what's happening around you.
And wear a helmet, at the very least.
I saw that! Greyed-out Wolverine model bouncing off the log truck lol