I have a line from A to B and point C. I have the coordinates of A, B, and C, and I need to find the location of D which is the closest point on the line to C:
Keep in mind that A, B, and C could be any point in space. I have tried many attempts and failed.

What you need is the perpendicular projection of $\vec{C}$ on the line through $\vec{A}$ and $\vec{B}$. To learn more try this wiki: https://en.wikipedia.org/wiki/Vector_projection
We can use the dot product to compute this vector projection, keeping in mind that the vectors aren't normalized when we plug this vector into the formula $\frac{a\cdot b}{b\cdot b}b$ we get:
$$\vec{D}-\vec{A} = \frac{(\vec{B}-\vec{A})\cdot(\vec{C}-\vec{A})}{(\vec{B}-\vec{A})\cdot(\vec{B}-\vec{A})} (\vec{B}-\vec{A}).$$
If you bring $\vec{A}$ over to the other side of the equation, you get a formula for $\vec{D}$ in terms of $\vec{A}, \vec{B}$ and $\vec{C}$.
EDIT:
For example If we take $\vec{A} = (0, 0)$, $\vec{B} = (1, 1)$ and $\vec{C} = (1, 0)$.
In this case $\vec{B} - \vec{A} = (1, 1) - (0, 0) = (1, 1)$.
The squared norm of this vector is $(\vec{B}-\vec{A})\cdot (\vec{B}-\vec{A}) = (1, 1) \cdot (1, 1) = 1.1+1.1 = 2$
The other vector is $\vec{C}-\vec{A} = (1, 0) - (0, 0) = (1, 0)$.
The innerproduct of these vectors is $(\vec{B}-\vec{A})\cdot (\vec{C}-\vec{A}) = (1, 1)\cdot(1, 0) = 1.1 + 1.0 = 1$.
The quotient of these two innerproducts is $\frac{(\vec{B}-\vec{A})\cdot(\vec{C}-\vec{A})}{(\vec{B}-\vec{A})\cdot(\vec{B}-\vec{A})} = \frac{1}{2}.$
To get the vector $\vec{D}-\vec{A}$ we need to multiply this fraction by $\vec{B}-\vec{A}$. This means the following calculation $\frac{(\vec{B}-\vec{A})\cdot(\vec{C}-\vec{A})}{(\vec{B}-\vec{A})\cdot(\vec{B}-\vec{A})} (\vec{B}-\vec{A}) = \frac{1}{2} (\vec{B}-\vec{A}) = \frac{1}{2}(1, 1) = (.5, .5)$.
Finally we computed the vector $\vec{D}-\vec{A}$, to get the exact position of $\vec{D}$ we add $\vec{A}$. In other words $\vec{D} = (.5, .5) + \vec{A} = (.5, .5) + (0, 0) = (.5, .5)$.
As expected the point $\vec{D}$ lies at coordinates $(.5, .5)$.