In the category of Hausdorff spaces and continuous maps, the inclusion $\mathbb{Q} \to \mathbb{R}$ is epic, because $\mathbb{Q}$ is dense in $\mathbb{R}$ and I think in a way the notion of epic arrow is a good translation of what density means.
For instance in the category of rings and ring morphisms, the inclusion $\mathbb{Z}\to\mathbb{Q}$ is again epic, and this shows that in a sense $\mathbb{Z}$ is dense in $\mathbb{Q}$: $\mathbb{Q}$ is (as a ring) "entirely determined" by $\mathbb{Z}$. Obviously this density isn't the one in the sense of the usual topology on these rings.
However I was wondering if this can be captured in a certain topology on $\mathbb{Q}$, and more generally I have the following question :
Given a category of structured sets (for instance a category of algebras in the sense of universal algebra- in particular varieties for instance) and structure-preserving maps, can the structured sets always be furnished with a topology that makes epimorphisms in said category the morphisms whose image is dense (wrt to said topology) ?
If you have an answer in a specific case, I'll take it as well, I don't necessarily need an answer as general as the question. For instance if you have an answer for the category of rings, or for varieties, or for algebras, etc. I'll be glad to hear it.
EDIT : As has been noted in a comment, the trivial topology would work. As this obviously isn't satisfactory, I'll think about other things that such a topology would have to verify. But still, you can try and guess what I would expect from it, until I come up with natural things to prevent trivial examples
Let $V$ be a variety. If $A, B\in V$ and $A$ is a subalgebra of $B$, and $b\in B$, then $A$ dominates $b$ relative to $V$ if any two homomorphisms that agree on $A$ also agree on $b$. The set of elements of $B$ dominated by $A$ is the dominion of $A$ in $B$ relative to $V$. The map that assigns a subset its dominion is a closure operator on $B$. A homomorphism into $B$ is an epimorphism iff its image is dense with respect to this closure operator.
Dominion is not a topological closure operator: closed sets are subalgebras, so the union of two closed sets is usually not closed. Also, the empty subset need not be closed. However, it may be that what is wanted it just a link between epimorphisms and denseness, in which case I would suggest Isbell's paper:
J. Isbell. Epimorphisms and dominions. In Proceedings of the Conference on Categorical Algebra: La Jolla 1965 , pages 232246. Springer Berlin Heidelberg, 1966.
For a more recent description of this closure operator, you might look at the 2016 preprint
Epic substructures and primitive positive functions by Miguel Campercholi, which you can download from
https://arxiv.org/abs/1607.03139