If it is possible to obtain a unique solution to $Ax=b$ subject to the constraints $Cx =d,$ then you can obtain it with Lagrange multipliers.
To be explicit, suppose $A$ is an $n\times p$ matrix, $x$ is a $p$-vector, $b$ is an $n$-vector, $C$ is an $r\times p$ matrix (the coefficients of $r$ linear constraints), and $d$ is an $r$ vector (the values of those constraints). The Lagrange multipliers $\lambda$ will be an $r$-vector.
The system that results from minimizing $||Ax-b||^2 = x^\prime A^\prime A x - 2x^\prime A^\prime b + b^\prime b$ subject to $Cx-d = 0$ is $A^\prime A x + \lambda^\prime C = 0$ and $Cx = d,$ to be solved for $x$ and $\lambda.$ In block matrix notation this can be written as a set of $p+r$ equations in the $p+r$ variables,
$$\pmatrix{A^\prime A & C^\prime \\ C & 0}\pmatrix{x \\ \lambda} = \pmatrix{A^\prime b\\d}$$
with solution
$$\pmatrix{x \\ \lambda} = \pmatrix{A^\prime A & C^\prime \\ C & 0}^{-1}\pmatrix{A^\prime b\\d}$$
This system can still be singular. That would mean imposing the constraints did not create an identifiable model.
Important comment
This solution does not assume $A^\prime A$ is singular. Thus, it solves any least-squares problem subject to a set of linear constraints. You might have to understand the solution in the sense of a generalized (Moore-Penrose) inverse, as is always the case with ordinary least squares.
Simple example
Let
$$A = \pmatrix{1&1\\1&1\\1&1};\quad b = \pmatrix{1\\2\\3};\quad C = \pmatrix{1&2};\quad d = \pmatrix {-1},$$
for which the dimensions are $n=3,$ $p=2,$ and $r=1.$ $A$ is obviously rank-deficient because its columns are linearly dependent.
This problem seeks to minimize $(x_1+x_2-1)^2 + (x_1+x_2-2)^2 + (x_1+x_2-3)^2$ subject to the constraint $x_1 + 2x_2 = -1.$ Writing
$$\pmatrix{A^\prime A & C^\prime \\ C & 0} = \pmatrix{3&3&1\\3&3&2\\1&2&0}\quad \text{and}\quad \pmatrix{A^\prime b\\d} = \pmatrix{6\\6\\-1},$$
the solution is
$$\pmatrix{x_1\\x_2\\\lambda} = \pmatrix{5\\-3\\0}.$$
To check the solution, you can easily check that $Cx=d$ holds. Notice that the constraint $Cx=d$ implies $x_1+x_2=-1-x_2.$ Plugging this into the least squares objective gives
$$\begin{aligned}
(x_1+x_2-1)^2 + (x_1+x_2-2)^2 + (x_1+x_2-3)^2 \\
= (-x_2-1)^2 + (-x_2-2)^2 + (-x_2-3)^2\\
= 3x_2^2 + 18 x_2 + 29
\end{aligned}$$
whose derivative $6x_2 + 18$ has a unique critical point at $x_2=-3,$ whence $x_1 = -1 - 2x_2 = 5,$ verifying the solution really does minimize the squared distance between $Ax$ and $b.$