Let $S$ be a semisimple connected Lie group with infinite center (e.g., the universal covering of $\mathrm{SL}_2(\mathbf{R}$. Let $K$ be the circle group. Let $Z\subset S\times K$ be the graph of a homomorphism with dense image $Z(S)\to K$; this is a discrete central subgroup. Then $(S\times K)/Z$ is a reductive Lie group whose derived subgroup is dense and not closed.
On the other hand, it is not hard to prove that if a reductive Lie group has derived subgroup $S$ with finite center, then $S$ is closed.