You should move the 2nd IF block inside the 1st one, because the local
variable is initialized only inside the 1st IF.
So you should modify your code like this (I updated the code after you update your code in your provided solution):
bool? pass = null;
foreach (Software.dsBDD.list_table21 row in dataTable.Rows)
if (this.pass.HasValue && this.end)
pass = this.pass;
if (pass != null && pass.GetValueOrDefault() || row.view_only)