In the absolute vacuum of Space, will an electric dynamo still work? Can it produce an electric current if it is not inside (or being affected by) a magnetic field (like earth's magnetosphere)?
Unless the lubrication system fails in the dynamo that is in vacuum, electrical generation will work. Magnetic fields are unaffected by air or the lack of, at least at the level under consideration.
Earth's magnetic field is too weak to have an effect on the generation of electricity by a dynamo. You can see how weak is the magnetic field of our planet by placing a compass on a stable surface. It is reading the planetary magnetic field. Bring a lightly magnetic item nearby and the needle of the compass will deflect.
The dynamo is going to have many times the strength of the lightly magnetic item and will not change due to the earth's field.
This isn't quite as trivial a question as it first seems, since a self-excited dynamo needs an initial external magnetic field to start working. In principle, the Earth's magnetic field, weak as it is, could serve to kickstart the self-excitation.
In practice, though, the initial field is normally supplied either by residual ferromagnetism of the stator core or by deliberately energizing the coil from an external source such as a battery. Either method can generate a much stronger initial field than the Earth's magnetic field alone would, and they'll also work fine even outside the Earth's magnetosphere.