Flood-fill all the connected walls from some starting wall. You can do this either by setting the walls to some other value (e.g. 2) or having another 2D array just for this.
Run through the maze again. If you find any wall that hasn't been filled in the above step, we know it's not connected to the rest.
But it might also make sense (perhaps more sense) to make this part of your solving algorithm by just marking the cells you've already visited as visited and not revisiting already visited cells (again using another value or another array, as above). If you do this, it doesn't really matter whether or not the walls aren't connected.