If you are shooting in an auto-exposure mode, keep in mind that the camera WILL try to expose for ambient light, no matter what, even with the flash attached, and use the flash for fill.
If you're in aperture-priority or program modes, that can give you excessively long shutter speeds, which you have here.
If you want to light with the flash, set the camera manually. If you want the ambient light as best as you can get it, again, go manual, or shutter-priority, so you can control shutter speed. You will probably end up with maximum aperture being used, which will minimize your depth of field.
Don't be afraid to up the ISO if you need to, depending on the camera. An old D3000 probably shouldn't go past 800, if even that far. A D810 can shoot acceptably at 6400.